<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>选择合同模板</title>
		<script type="text/javascript" src="plug-in/mutiLang/zh-cn.js"></script>
		<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="plug-in/jquery/jquerysession.js"></script>
		<%--<script type="text/javascript" src="plug-in/"></script>--%>
		<script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
		<link id="easyuiTheme" rel="stylesheet" href="plug-in/easyui/themes/default/easyui.css" type="text/css"></link>
		<link rel="stylesheet" href="plug-in/easyui/themes/icon.css" type="text/css"></link>
		<link rel="stylesheet" type="text/css" href="plug-in/accordion/css/accordion.css">
		<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
		<script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
		<script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
		<script type="text/javascript" src="plug-in/easyui/extends/datagrid-scrollview.js"></script>
		<script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
		<link rel="stylesheet" href="plug-in/tools/css/common.css" type="text/css"></link>
		<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
		<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
		<script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
		<script type="text/javascript" src="plug-in/jquery-plugs/hftable/jquery-hftable.js"></script>
		<link rel="stylesheet" href="plug-in/jquery/jquery-autocomplete/jquery.autocomplete.css" type="text/css"></link>
		<script type="text/javascript" src="plug-in/jquery/jquery-autocomplete/jquery.autocomplete.min.js"></script>
		<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
		<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
	</head>
	<script>
		function choose(){
		    var id="";
            if($('input[type=checkbox]:checked').length!=1){
                tip("请选择一条合同")
            }else{
                $("input[type='checkbox']:checked").each(function (){
                    id+=$(this).val();
                });
                $.ajax({
                    async : false,
                    cache : false,
                    type : 'POST',
                    data : {"id": id},
                    traditional:true,
                    url : 'cbsContractController.do?choose', // 请求的action路径
                    error : function() {// 请求失败处理函数
                    },
                    success : function(data) {
                        var d = $.parseJSON(data);
                        console.log(d);
                        addOneTab('新建合同', 'cbsContractController.do?goAdd&code=choose&slaId='+d+"&contractId="+id, '');
                        frameElement.api.close();
                    }
                });
			}

		}
	</script>
	<body>
		<table class="ftable">
			<tbody>
				<tr>
					<th></th>
					<th>合同名称</th>
					<th>合同编号</th>
					<th>最后更新时间</th>
				</tr>
				<c:forEach items="${contractList}" var="contract" varStatus="a">
					<tr>
						<td><input type="checkbox" name="id" value="${contract.id}"></td>
						<td>${contract.contractName}</td>
						<td>${contract.contractCode}</td>
						<td><fmt:formatDate value='${contract.updateDate}' type="date" pattern="yyyy-MM-dd"/></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div style="width: 98%; text-align: center; margin: 10px auto;">
			<a href="#" class="easyui-linkbutton l-btn" onclick="choose()">确定</a>
		</div>
	</body>

</html>
